<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Composite Injection</title></head>


<body>
<h3>Overview</h3>

<p>This is also where a component has is a blend of one or more
    of Constructor, Setter, Method, Annotated Field. The difference is that
    you know precisely what your injection design is and want to tune
    specifically for that, or you are some way off the defaults supported
    by <strong>MultiInjection</strong></p>

<div class="source">
<pre>public class Apple {
    private Orange orange;
    private Pear pear;
    @FruitNeeded
    private Banana banana;
    public Apple(Orange orange) {
        this.orange = orange;
    }
    public void fruitNeeded(Pear pear) {
        this.pear = pear;
    }
 // other methods
}</pre>
</div>
<h3>Usage</h3>

<div class="source">
<pre>pico = new DefaultPicoContainer(new CompositeInjection(
    new ConstructorInjection(), new AnnotatedFieldInjection(FruitNeeded.class),
	new MethodInjection("fruitNeeded")));
pico.addComponent(Apple.class);
// etc
Apple apple = pico.getComponent(Apple.class);</pre>
</div>
<p>&nbsp;In the case above, Orange comes in through the
    constructor,
    Pear by method injection and Banana is via Annotated Field Injection.</p>

<p>The component factory for this is <strong>CompositeInjection</strong>.</p>

</body>
</html>